<!--
 * @Author: zouyanrong 466901787@qq.com
 * @Date: 2025-05-06 15:34:07
 * @LastEditors: ganjiejie 8025279+ganjiejie@user.noreply.gitee.com
 * @LastEditTime: 2025-05-15 10:07:55
 * @FilePath: \gj-vite-vue3-ts-pinia\src\views\tab\index.vue
 * @Description: TAB切换
 * 
 * Copyright (c) 2025 by ${git_name_email}, All Rights Reserved. 
-->
<template>
    <div class="index-container">
        <!-- 头部tab栏 -->
        <header class="tab-wapper">
            <div @click="tabIndex = 0" class="tab-btn" :class="{ active: tabIndex === 0 }">排名</div>
            <div @click="tabIndex = 1" class="tab-btn" :class="{ active: tabIndex === 1 }">球员</div>
        </header>
        <!-- 内容 -->
        <div class="content">
            <!-- 球队 -->
            <div v-show="tabIndex === 0" class="rank-list">
                <tabItem v-for="item in playerList" :key="item.id" :item="item" :max-hot="10000"/>
            </div>
            <!-- 球员 -->
            <div v-show="tabIndex === 1">我是球员列表</div>
        </div>
    </div>
</template>
<script setup>
import { ref } from 'vue'
import tabItem from './components/tabItem.vue';
const tabIndex = ref(0)
const playerList = ref([{
    name: '哥哥',
    number: 1,
    handsome: '7831',
    img: 'ge1.jpg'
}, {
    name: '哥哥',
    number: 2,
    handsome: '7823',
    img: 'ge2.jpg'
}, {
    name: '哥哥',
    number: 3,
    handsome: '9273',
    img: 'ge3.jpg'
}]);
</script>
<style lang="scss" scoped>
.index-container {
    width: 800px;
    box-sizing: border-box;
    padding: 20px;
    background: rgb(137, 182, 202);

    .tab-wapper {
        display: flex;
        justify-content: center;
        font-size: 24px;
        border-radius: 10px;
        overflow: hidden;

        .tab-btn {
            flex: auto;
            text-align: center;
            background: #cddee6;
            cursor: pointer;
            transition: 0.5s;
            padding: 10px;
        }

        .tab-btn:not(.active):hover {
            background: #cd9fdf;
        }

        .active {
            color: #fff;
            background: #cd9fdf;
        }
    }

    .content {
        .rank-list {
            margin: 20px;

        }
    }
}
</style>
